package com.yanqu.road.server.manger.activity.qixi.service;

import com.google.protobuf.InvalidProtocolBufferException;
import com.yanqu.road.dao.impl.player.UserQixiRelationDaoImpl;
import com.yanqu.road.entity.qixi.UserQixiRelationData;
import com.yanqu.road.pb.activity.QixiProto;
import com.yanqu.road.pb.syncMessage.SyncMessage;
import com.yanqu.road.server.game.service.IGameServiceCommand;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.qixi.QixiModule;
import com.yanqu.road.server.manger.activity.qixi.QixiMgr;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.sync.message.SyncResponse;
import com.yanqu.road.utils.YanQuMessageUtils;

import java.util.Map;

public class QixiNewBroadcastFromOtherServiceCmd implements IGameServiceCommand {
    @Override
    public SyncResponse execute(SyncMessage.Request request) throws InvalidProtocolBufferException {
        SyncResponse syncResponse = new SyncResponse();
        QixiProto.CorssQixiFlowerBroadcastMsg resultMsg = QixiProto.CorssQixiFlowerBroadcastMsg.parseFrom(request.getDataBytes());
        if (QixiMgr.getConfig() != null) {
            QixiProto.CorssQixiFlowerBroadcastMsg.Builder builder = resultMsg.toBuilder().setActivityId(QixiMgr.getConfig().getActivityId());
            GamePlayerMgr.sendPacket(0, YanQuMessageUtils.buildMessage(CrossProtocol.C_QIXI_SEND_FLOWER_BROADCAST, builder));
        }

        return syncResponse;
    }
}
